﻿ 
using CodeManDesktopBlazor.BlazorComponents.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeManDesktopBlazor
{
    public enum LangFlagenum
    {
        /// <summary>
        /// en-US
        /// </summary>
        [Description("en-US")]
        en = 0,
        /// <summary>
        /// zh-CN
        /// </summary>
        [Description("zh-CN")]
        zh = 1
    }
    public static class GData
    {
        public static MainWindow currMainWindow { get; set; }
        /// <summary>
        /// 表格除所有行差
        /// </summary>
        public const int tableHeightDiff = 175;

        public static LangFlagenum DefaultThreadCurrentCulture = LangFlagenum.zh;
        public static MainJs mainjs;
        public static int tableHeight { get { return mainjs.heightInt - tableHeightDiff; } }
        public static int tableWidth { get { return mainjs.widthInt; } }

        /// <summary>
        /// 设置默认文化为 
        /// zh-CN,en-US
        /// </summary>
        public static void SetCurrentCulture(LangFlagenum langFlagenum)
        {
            CultureInfo.CurrentCulture = new CultureInfo(langFlagenum.GetDescription());
            CultureInfo.CurrentUICulture = new CultureInfo(langFlagenum.GetDescription());
        }
        public static void SetDefaultThreadCurrentCulture(LangFlagenum langFlagenum)
        {
            var culture = new CultureInfo(langFlagenum.GetDescription());
            CultureInfo.DefaultThreadCurrentCulture = culture;
            CultureInfo.DefaultThreadCurrentUICulture = culture;
        }


    }
}
